package com.encryption.logic;

import java.util.List;

import com.encryption.dao.ManageActionDAO;
import com.encryption.model.ManageAction;

public class ManageActionManager {
	public static ManageActionManager instance = new ManageActionManager();
	private ManageActionDAO actionDAO = null;
	private List<ManageAction> actionList = null;
	
	private ManageActionManager(){
		actionDAO = ManageActionDAO.getInstance();
	}
	
	public static ManageActionManager getInstance(){
		return instance;
	}
	
	public List<ManageAction> getAll(){
		if(actionList == null)
			actionList = actionDAO.findAll();
		return actionList;
	}
	
	public ManageAction getByActionId(int actionId){
		List<ManageAction> list = getAll();
		for (ManageAction action : list){
			if(action.getId().intValue() == actionId)
				return action;
		}
		
		return null;
	}

}
